<!DOCTYPE html>
<html>
<head>
    <title>修改房源状态</title>
<#include "../common/common.ftl"/>
</head>
<body>
<div class="layui-fluid">
    <form class="layui-form" id="houseForm">
        <input type="hidden" name="houseId" value="${(house.id)!}"/>
        <div class="layui-card">
            <div class="layui-card-header">修改房源状态</div>
            <div class="layui-card-body">

                <div class="layui-form-item">
                    <label class="layui-form-label">房源信息：</label>
                    <div class="layui-form-mid">${(house.azProject.projectName)!}${(house.buildNum)!}
                        号楼${(house.houseNum)!}</div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">房源状态：</label>
                    <div class="layui-input-block">
                    <#if (dataDictList?? && dataDictList?size gt 0) >
                        <#list dataDictList as dataDict>
                        <#if (dataDict.value)!?number != 2>
                            <input type="radio" <#if (house.houseStatus)! == (dataDict.value)!?number>checked</#if> name="houseStatus" value="${dataDict.value}" title="${(dataDict.name)!}"/>
                        </#if>
                    </#list>
                        </#if>
                    </div>
                </div>
            </div>
        </div>

        <button style="display: none;" class="layui-btn" id="submitBtn" name="submitBtn" lay-submit=""
                lay-filter="submit">立即提交
        </button>
    </form>
</div>
<script src="/layui/layui.js" charset="utf-8"></script>
<script>
    layui.config({
        base: '/modules/' //静态资源所在路径
    }).use(['form', 'dataDict'], function () {
        var form = layui.form, $ = layui.jquery, parentIndex = parent.layer.getFrameIndex(window.name);

        //监听提交
        form.on('submit(submit)', function (data) {
            $.ajax({
                url: 'saveHouseStatus',
                type: 'post',
                data: $("#houseForm").serialize(),//当前容器的全部表单字段，名值对形式：{name: value}
                async: false,
                success: function (data) {
                    if (data.code == "0001") {
                        var data1 = data.data;
                        var azProjectId = data1.azProjectId;
                        var buildNum = data1.buildNum;
                        parent.loadHousePicture(azProjectId, buildNum);
                        parent.layer.close(parentIndex);
                    } else {
                        layer.msg(data.message, {anim: 6, icon: 2, time: 3000});
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>